import com.heima.admin.AdminApplication;
import com.heima.aliyun.GreenImageScan;
import com.heima.aliyun.GreenTextScan;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@SpringBootTest(classes = AdminApplication.class)
@RunWith(value = SpringRunner.class)
@Slf4j
public class Demo {

    @Autowired
    GreenImageScan greenImageScan;

    @Autowired
    GreenTextScan greenTextScan;

    @Test
    public void textText() throws Exception {
        Map map = greenTextScan.greenTextScan("我是一个文本,冰毒买卖是违法的");
        log.info("如果走到这里代表检测成功,上边内容为文本敏感词检测");
        System.out.println(map);
    }

    @Test
    public void imageTest() throws Exception {
        List imageslist = new ArrayList();
        imageslist.add("这个集合里面到时候添加图片的url地址可以添加多个");
        Map map = greenImageScan.imageUrlScan(imageslist);
        System.out.println(map);

    }


}
